package com.stone.springboot.bean;

import com.stone.springboot.sercives.Builder;
import lombok.ToString;

/**
 * Created by stone on 2017/7/31.
 */
@ToString
public class Student {

    private String name;

    private Integer age;

    private Student() {}

    private Student(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public static StudentBuilder builder(){
        return new StudentBuilder();
    }

    public static class StudentBuilder implements Builder<Student> {

        private String name;

        private Integer age;

        public StudentBuilder name(String name) {
            this.name = name;
            return this;
        }

        public StudentBuilder age(Integer age) {
            this.age = age;
            return this;
        }

        @Override
        public Student build() {
            return new Student(name, age);
        }
    }
}
